//
//  UIButton+WQExtension.m
//  WangJingApp
//
//  Created by 魏强 on 17/2/13.
//  Copyright © 2017年 KDTech. All rights reserved.
//

#import "UIButton+WQExtension.h"
#import "UIButton+WebCache.h"
#import "UIImage+WQExtension.h"
@implementation UIButton (WQExtension)
- (void)setHeaderWithUrl:(NSString *)url forState:(UIControlState)state placeholderStr:(NSString *)placeholderStr
{
    UIImage *placeholder = [[UIImage imageNamed:placeholderStr] circleImage];
    [self sd_setImageWithURL:[NSURL URLWithString:url] forState:state completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        KDLog(@"%@",error);
        if (image) {
            [self setImage:[image circleImage] forState:state];
        }else{
            [self setImage:placeholder forState:state];
        }
    }];
}
@end
